package com.dong.condition;

import com.dong.config.T022ConditionConfig;
import org.springframework.context.annotation.Condition;
import org.springframework.context.annotation.ConditionContext;
import org.springframework.core.type.AnnotatedTypeMetadata;

import java.time.LocalTime;

/**
 * 用于测试条件创建bean
 * @see T022ConditionConfig
 */

public class MyCondition implements Condition {

    public boolean matches(ConditionContext context, AnnotatedTypeMetadata metadata) {
        LocalTime now = LocalTime.now();
        int second = now.getSecond();
        if(second>30) {
            return true;
        }
        return false;
    }
}
